package com.example.itcacp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.itcacp.entity.Tag;
import com.example.itcacp.repository.mybatis.TagMapper;
import com.example.itcacp.service.TagService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TagServiceImpl extends ServiceImpl<TagMapper, Tag> implements TagService {

    @Resource
    private TagMapper tagMapper;

    @Override
    public List<Tag> selectTagAll() {
        return tagMapper.selectTagAll( null );
    }

    @Override
    public PageInfo<Tag> selectTagPage(Integer pageNum, Integer pageSize, String tagName) {
        // 开启分页
        PageHelper.startPage ( pageNum, pageSize );
        List<Tag> tagList =  tagMapper.selectTagAll ( tagName );
        return PageInfo.of ( tagList );
    }
}
